const http = require('../../util/http')
Page({
  onShareAppMessage() {
    return {
      title: '首页',
      path: 'entry/index/index',
    };
  },
  data: {
    activityList: [],
    baseurl: http.baseURL,
  },
  onLoad(){
    this.getActivityList()
  },
  openDetial(e) {
    const item = e.currentTarget.dataset.item
    xhs.navigateTo({
      url: '/entry/activityList/index?activityId='+item.activityId +'&productName='+item.productName+'&fileUrl='+item.fileUrl
    });
  },
  getActivityList(){
    xhs.showLoading({
      title: '加载中',
    })
    http.get('/api/activity/getActivityList').then(res => {
      console.log('res',res)
      xhs.hideLoading()
			if (res.code == 200) {
				this.setData({
          activityList:res.data
				})
			}
		})
  },
  openSearch() {
    xhs.navigateTo({
      url: '/entry/search/search'
    });
  },
  onChange(e) {
    console.log('swiper bindChange', e);
  },
  scroll(e) {
    console.log('获取滚动事件的详细信息e.detail：', e.detail);
    // 此处只做对scrollTop值的监听，不需要使用setData对视图层发起更新
    this.data.scrollTop = e.detail.scrollTop;
  },
  upper() {
    xhs.showToast({
      title: '到顶了',
      icon: 'none'
    });
  },

  lower() {
    xhs.showToast({
      title: '到底了',
      icon: 'none'
    });
  },
});
